package com.boyunv.composite.example02;
/*
 *@description
 *
 *@author boyunv
 *@create 2023/8/1 7:32
 *@version 1.0
 */

public class Client {
 public static void main(String[] args) {
    //创建根节点
  Directory rootDir = new Directory("root");
  Directory binDir = new Directory("bin");
  //象binadd叶子节点
  binDir.add(new File("vi",10000));
  binDir.add(new File("test",20000));

  Directory tmpDir = new Directory("tmp");

  Directory usrDir = new Directory("usr");
  Directory mysqlDir = new Directory("mysql");
  mysqlDir.add(new File("my.cnf",30));
  mysqlDir.add(new File("test.txt",25000));
  usrDir.add(mysqlDir);

  //将所有的子文件夹封装到根节点
  rootDir.add(binDir);
  rootDir.add(tmpDir);
  rootDir.add(usrDir);
  rootDir.printList("");

 }
}
